<?php

class Persion {
    public $name = 'lisi';
    public $age = 22;

    public function __construct($name='',$age=0)
    {
        echo '我是Persion类的构造方法';
        print('<br>');
        $this->name=$name;
        $this->age = $age;
        $this->test();
    }
    public function test()
    {
        print('<br>');
        echo 'Persion->test';
    }
    public function setAge($age=23){
        $this->__construct($this->name,$age);
    }
}

$p1 = new Persion('lisi',25);
$p2 = new Persion('wangwu',32);
$p3 = new Persion('zhangshan',23);
$p4 = new Persion();
$p4->__construct('zhangsan',50);

print_r($p1);
print('<br>');
print_r($p2);
print('<br>');
print_r($p3);
print('<br>');
print_r($p4);
print('<br>');
$p4->setAge(27);
print_r($p4);